﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GuiGames {

    /// <summary>
    /// Allows the user to select a type of game.
    /// </summary>
    public partial class Games : Form {
        
        public Games() {
            InitializeComponent();
            InitForm();
        }

        public void InitForm()
        {
            ckbGame.Items.Add("Two Up");
            ckbGame.Items.Add("Twenty-One");
            ckbGame.Items.Add("Crazy Eights");
            ckbGame.Items.Add("Pig");
            btnStart.Enabled = false;
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void ckbGame_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!btnStart.Enabled)
            {
                btnStart.Enabled = true;
            }
        }

        private void btnStart_Click(object sender, EventArgs e)
        {
            switch (ckbGame.SelectedIndex)
            {
                case 0:
                    TwoUpForm twoUpForm = new TwoUpForm(this);
                    twoUpForm.Show();
                    break;
                case 1:
                    TwentyOneForm twentyOneForm = new TwentyOneForm(this);
                    twentyOneForm.Show();
                    break;
                case 2:
                    CrazyEightsForm crazyEightsForm = new CrazyEightsForm(this);
                    crazyEightsForm.Show();
                    break;
                case 3:
                    PigForm pigForm = new PigForm(this);
                    pigForm.Show();
                    break;
                default:
                    break;
            }
            this.Hide();
        }
    }// end class Games
}//end namespace
